home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HyperLib 1997 Winter - Disc 1
/
HYPERLIB-1997-Winter-CD1.ISO.7z
/
HYPERLIB-1997-Winter-CD1.ISO
/
オンラインウェア
/
PRG
/
WASTE Object Handlers 1.2.2.sit
/
WASTE Object Handlers 1.2.2
/
Handler Source
/
WE_PICT_Handler.c
< prev
next >
Wrap
Text File
|
1996-07-18
|
3KB
|
116 lines
// PICT Object Handler for the WASTE Text Engine
// by Michael F. Kamprath, kamprath@kagi.com
// maintenance by John C. Daub, hsoi@eden.com
//
// v1.0, 12 March 1995
// v1.1, 5 June 1995, Added InstallPICTObject() to install the PICT handler
// by itself.
// v1.2, 28 March 1996. Minor updates. Added precompiler directives, WASTE 1.2a5 compatability
//
// v1.2.2, 16 July 1996. Added compatability with WASTE 1.2 and CW9
// Restructured installation routines
#ifndef _WASTE_
#include "WASTE.h"
#endif
#include "WE_PICT_Handler.h"
#ifndef _WASTEOBJECTS_
#include "WASTE_Objects.h"
#endif
//
// InstallPICTObject()
// Installs the PICT handler into WASTE.
//
OSErr InstallPICTObject( WEReference theWE )
{
OSErr iErr;
#ifdef __cplusplus
static WENewObjectUPP newPICTUPP = NewWENewObjectProc(HandleNewPicture);
static WEDisposeObjectUPP disposePICTUPP = NewWEDisposeObjectProc(HandleDisposePicture);
static WEDrawObjectUPP drawPICTUPP = NewWEDrawObjectProc(HandleDrawPicture);
#else
static WENewObjectUPP newPICTUPP = NULL;
static WEDisposeObjectUPP disposePICTUPP = NULL;
static WEDrawObjectUPP drawPICTUPP = NULL;
if ( newPICTUPP == NULL )
newPICTUPP = NewWENewObjectProc(HandleNewPicture);
if ( disposePICTUPP == NULL )
disposePICTUPP = NewWEDisposeObjectProc(HandleDisposePicture);
if ( drawPICTUPP == NULL )
drawPICTUPP = NewWEDrawObjectProc(HandleDrawPicture);
#endif
if ( newPICTUPP != NULL )
iErr = WEInstallObjectHandler(kTypePicture, weNewHandler, (UniversalProcPtr)newPICTUPP, theWE);
else
iErr = weUnknownObjectTypeErr;
if (iErr) return(iErr);
if ( disposePICTUPP != NULL )
iErr = WEInstallObjectHandler(kTypePicture, weDisposeHandler, (UniversalProcPtr)disposePICTUPP, theWE);
else
iErr = weUnknownObjectTypeErr;
if (iErr) return(iErr);
if ( drawPICTUPP != NULL )
iErr = WEInstallObjectHandler(kTypePicture, weDrawHandler, (UniversalProcPtr)drawPICTUPP, theWE);
else
iErr = weUnknownObjectTypeErr;
if (iErr) return(iErr);
return(noErr);
}
//
// New Object Handler for PICTs
//
pascal OSErr HandleNewPicture(Point *defaultObjectSize,WEObjectReference objectRef)
{
PicHandle thePic;
Rect theFrame;
thePic = (PicHandle)WEGetObjectDataHandle(objectRef);
theFrame = (*thePic)->picFrame;
OffsetRect(&theFrame, -theFrame.left, -theFrame.top);
*defaultObjectSize = botRight(theFrame);
return(noErr);
}
//
// Dispose Object Handler for PICTS
//
pascal OSErr HandleDisposePicture(WEObjectReference objectRef )
{
PicHandle thePic;
thePic = (PicHandle)WEGetObjectDataHandle(objectRef);
if (thePic)
KillPicture(thePic);
return(MemError());
}
//
// Draw Object Handler for PICTs
//
pascal OSErr HandleDrawPicture (Rect *destRect, WEObjectReference objectRef )
{
PicHandle thePic;
thePic = (PicHandle)WEGetObjectDataHandle(objectRef);
DrawPicture(thePic, destRect);
return( noErr );
}